package com.itheima.mobilesafe.viruskilling;

import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.itheima.mobilesafe.R;

public class NetVirusInformationActivity extends AppCompatActivity  implements View.OnClickListener{

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_net_virus_information);

        Intent intent = getIntent();
        String chose_md5 = intent.getStringExtra("chose_md5");
        initview();
        initwebview(chose_md5);
    }

    public void initview(){
        //设置蓝色背景
        RelativeLayout title_bar = findViewById(R.id.title_bar);
        title_bar.setBackgroundColor(getResources().getColor(R.color. blue_color));
        TextView tv_back = findViewById(R.id.tv_back);//获取返回键
        tv_back.setOnClickListener(this);//设置返回键的点击事件的监听器
        ((TextView) findViewById(R.id.tv_main_title)).setText("病毒信息公示");//设置界面标题
        tv_back.setVisibility(View.VISIBLE);//显示返回键
    }


    private void initwebview(String chose_md5) {

        WebView mywebview = findViewById(R.id.gzz_webview);
        mywebview.getSettings().setJavaScriptEnabled(true);
        mywebview.setWebViewClient(new WebViewClient());
        mywebview.loadUrl("https://habo.qq.com/file/showdetail?md5=" + chose_md5);
    }

    @Override
    public void onClick(View view) {
        switch (view.getId()) {
            case R.id.tv_back: //返回键点击事件
                finish();
                break;
        }
    }
}
